const http = require('http')
const fs = require('fs')
const { log } = require('console')
const server = http.createServer((rq, rs) => {
  rq.on('data', (data) => {

  })
  rs.setTimeout(1000)
  rs.writeHead(200, {
    'Content-Type': 'text/plain;charset=utf-8',
    'Access-Control-Allow-Origin': '*'
  });
  rs.on('timeout', () => {
    rs.write('nihao')
    rs.end()
  })
}).listen(8437, 'localhost', function () {
  console.log('服务已启动');
})
server.on('error', function (socket) {
})
server.on('close', function (err) {
  console.log('服务guanbi', err);
})